#pragma once
// MESSAGE XAP_SBG_GPS_POS_MSG PACKING

#define MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG 20810


typedef struct __mavlink_xap_sbg_gps_pos_msg_t {
 double lat; /*<   Latitude, positive North, deg */
 double longit; /*<   Longitude, positive East, deg */
 double alt; /*<   Altitude Above Mean Sea Level, m */
 uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/
 uint32_t gps_pos_status; /*<   GPS velocity fix and status bitmask */
 uint32_t gps_tow; /*<   GPS Time of Week, ms */
 float undulation; /*<   Altitude difference between the geoid and the Ellipsoid. (WGS-84 Altitude = MSL Altitude + undulation), m */
 float pos_acc_lat; /*<   1b Latitude Accuracy, m */
 float pos_acc_longit; /*<   1b Longitude Accuracy, m */
 float pos_acc_alt; /*<   1b Altitude Accuracy, m */
 uint16_t base_station_id; /*<   ID of the DGPS/RTK base station in use */
 uint16_t diff_age; /*<   Differential data age */
 int8_t sbg_id; /*<   Sbg device id */
 int8_t gps_id; /*<   Gps device id */
 uint8_t num_sv_used; /*<   Number of space vehicles used in GNSS solution */
} mavlink_xap_sbg_gps_pos_msg_t;

#define MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN 59
#define MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN 59
#define MAVLINK_MSG_ID_20810_LEN 59
#define MAVLINK_MSG_ID_20810_MIN_LEN 59

#define MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC 145
#define MAVLINK_MSG_ID_20810_CRC 145



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_XAP_SBG_GPS_POS_MSG { \
    20810, \
    "XAP_SBG_GPS_POS_MSG", \
    15, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_xap_sbg_gps_pos_msg_t, time_boot_ms) }, \
         { "sbg_id", NULL, MAVLINK_TYPE_INT8_T, 0, 56, offsetof(mavlink_xap_sbg_gps_pos_msg_t, sbg_id) }, \
         { "gps_id", NULL, MAVLINK_TYPE_INT8_T, 0, 57, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_id) }, \
         { "gps_pos_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_pos_status) }, \
         { "gps_tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_tow) }, \
         { "lat", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_xap_sbg_gps_pos_msg_t, lat) }, \
         { "longit", NULL, MAVLINK_TYPE_DOUBLE, 0, 8, offsetof(mavlink_xap_sbg_gps_pos_msg_t, longit) }, \
         { "alt", NULL, MAVLINK_TYPE_DOUBLE, 0, 16, offsetof(mavlink_xap_sbg_gps_pos_msg_t, alt) }, \
         { "undulation", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_xap_sbg_gps_pos_msg_t, undulation) }, \
         { "pos_acc_lat", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_lat) }, \
         { "pos_acc_longit", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_longit) }, \
         { "pos_acc_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_alt) }, \
         { "num_sv_used", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_xap_sbg_gps_pos_msg_t, num_sv_used) }, \
         { "base_station_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 52, offsetof(mavlink_xap_sbg_gps_pos_msg_t, base_station_id) }, \
         { "diff_age", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_xap_sbg_gps_pos_msg_t, diff_age) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_XAP_SBG_GPS_POS_MSG { \
    "XAP_SBG_GPS_POS_MSG", \
    15, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_xap_sbg_gps_pos_msg_t, time_boot_ms) }, \
         { "sbg_id", NULL, MAVLINK_TYPE_INT8_T, 0, 56, offsetof(mavlink_xap_sbg_gps_pos_msg_t, sbg_id) }, \
         { "gps_id", NULL, MAVLINK_TYPE_INT8_T, 0, 57, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_id) }, \
         { "gps_pos_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_pos_status) }, \
         { "gps_tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_xap_sbg_gps_pos_msg_t, gps_tow) }, \
         { "lat", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_xap_sbg_gps_pos_msg_t, lat) }, \
         { "longit", NULL, MAVLINK_TYPE_DOUBLE, 0, 8, offsetof(mavlink_xap_sbg_gps_pos_msg_t, longit) }, \
         { "alt", NULL, MAVLINK_TYPE_DOUBLE, 0, 16, offsetof(mavlink_xap_sbg_gps_pos_msg_t, alt) }, \
         { "undulation", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_xap_sbg_gps_pos_msg_t, undulation) }, \
         { "pos_acc_lat", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_lat) }, \
         { "pos_acc_longit", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_longit) }, \
         { "pos_acc_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_xap_sbg_gps_pos_msg_t, pos_acc_alt) }, \
         { "num_sv_used", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_xap_sbg_gps_pos_msg_t, num_sv_used) }, \
         { "base_station_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 52, offsetof(mavlink_xap_sbg_gps_pos_msg_t, base_station_id) }, \
         { "diff_age", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_xap_sbg_gps_pos_msg_t, diff_age) }, \
         } \
}
#endif

/**
 * @brief Pack a xap_sbg_gps_pos_msg message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param sbg_id   Sbg device id 
 * @param gps_id   Gps device id 
 * @param gps_pos_status   GPS velocity fix and status bitmask 
 * @param gps_tow   GPS Time of Week, ms 
 * @param lat   Latitude, positive North, deg 
 * @param longit   Longitude, positive East, deg 
 * @param alt   Altitude Above Mean Sea Level, m 
 * @param undulation   Altitude difference between the geoid and the Ellipsoid. (WGS-84 Altitude = MSL Altitude + undulation), m 
 * @param pos_acc_lat   1b Latitude Accuracy, m 
 * @param pos_acc_longit   1b Longitude Accuracy, m 
 * @param pos_acc_alt   1b Altitude Accuracy, m 
 * @param num_sv_used   Number of space vehicles used in GNSS solution 
 * @param base_station_id   ID of the DGPS/RTK base station in use 
 * @param diff_age   Differential data age 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint32_t time_boot_ms, int8_t sbg_id, int8_t gps_id, uint32_t gps_pos_status, uint32_t gps_tow, double lat, double longit, double alt, float undulation, float pos_acc_lat, float pos_acc_longit, float pos_acc_alt, uint8_t num_sv_used, uint16_t base_station_id, uint16_t diff_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN];
    _mav_put_double(buf, 0, lat);
    _mav_put_double(buf, 8, longit);
    _mav_put_double(buf, 16, alt);
    _mav_put_uint32_t(buf, 24, time_boot_ms);
    _mav_put_uint32_t(buf, 28, gps_pos_status);
    _mav_put_uint32_t(buf, 32, gps_tow);
    _mav_put_float(buf, 36, undulation);
    _mav_put_float(buf, 40, pos_acc_lat);
    _mav_put_float(buf, 44, pos_acc_longit);
    _mav_put_float(buf, 48, pos_acc_alt);
    _mav_put_uint16_t(buf, 52, base_station_id);
    _mav_put_uint16_t(buf, 54, diff_age);
    _mav_put_int8_t(buf, 56, sbg_id);
    _mav_put_int8_t(buf, 57, gps_id);
    _mav_put_uint8_t(buf, 58, num_sv_used);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN);
#else
    mavlink_xap_sbg_gps_pos_msg_t packet;
    packet.lat = lat;
    packet.longit = longit;
    packet.alt = alt;
    packet.time_boot_ms = time_boot_ms;
    packet.gps_pos_status = gps_pos_status;
    packet.gps_tow = gps_tow;
    packet.undulation = undulation;
    packet.pos_acc_lat = pos_acc_lat;
    packet.pos_acc_longit = pos_acc_longit;
    packet.pos_acc_alt = pos_acc_alt;
    packet.base_station_id = base_station_id;
    packet.diff_age = diff_age;
    packet.sbg_id = sbg_id;
    packet.gps_id = gps_id;
    packet.num_sv_used = num_sv_used;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
}

/**
 * @brief Pack a xap_sbg_gps_pos_msg message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param sbg_id   Sbg device id 
 * @param gps_id   Gps device id 
 * @param gps_pos_status   GPS velocity fix and status bitmask 
 * @param gps_tow   GPS Time of Week, ms 
 * @param lat   Latitude, positive North, deg 
 * @param longit   Longitude, positive East, deg 
 * @param alt   Altitude Above Mean Sea Level, m 
 * @param undulation   Altitude difference between the geoid and the Ellipsoid. (WGS-84 Altitude = MSL Altitude + undulation), m 
 * @param pos_acc_lat   1b Latitude Accuracy, m 
 * @param pos_acc_longit   1b Longitude Accuracy, m 
 * @param pos_acc_alt   1b Altitude Accuracy, m 
 * @param num_sv_used   Number of space vehicles used in GNSS solution 
 * @param base_station_id   ID of the DGPS/RTK base station in use 
 * @param diff_age   Differential data age 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint32_t time_boot_ms,int8_t sbg_id,int8_t gps_id,uint32_t gps_pos_status,uint32_t gps_tow,double lat,double longit,double alt,float undulation,float pos_acc_lat,float pos_acc_longit,float pos_acc_alt,uint8_t num_sv_used,uint16_t base_station_id,uint16_t diff_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN];
    _mav_put_double(buf, 0, lat);
    _mav_put_double(buf, 8, longit);
    _mav_put_double(buf, 16, alt);
    _mav_put_uint32_t(buf, 24, time_boot_ms);
    _mav_put_uint32_t(buf, 28, gps_pos_status);
    _mav_put_uint32_t(buf, 32, gps_tow);
    _mav_put_float(buf, 36, undulation);
    _mav_put_float(buf, 40, pos_acc_lat);
    _mav_put_float(buf, 44, pos_acc_longit);
    _mav_put_float(buf, 48, pos_acc_alt);
    _mav_put_uint16_t(buf, 52, base_station_id);
    _mav_put_uint16_t(buf, 54, diff_age);
    _mav_put_int8_t(buf, 56, sbg_id);
    _mav_put_int8_t(buf, 57, gps_id);
    _mav_put_uint8_t(buf, 58, num_sv_used);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN);
#else
    mavlink_xap_sbg_gps_pos_msg_t packet;
    packet.lat = lat;
    packet.longit = longit;
    packet.alt = alt;
    packet.time_boot_ms = time_boot_ms;
    packet.gps_pos_status = gps_pos_status;
    packet.gps_tow = gps_tow;
    packet.undulation = undulation;
    packet.pos_acc_lat = pos_acc_lat;
    packet.pos_acc_longit = pos_acc_longit;
    packet.pos_acc_alt = pos_acc_alt;
    packet.base_station_id = base_station_id;
    packet.diff_age = diff_age;
    packet.sbg_id = sbg_id;
    packet.gps_id = gps_id;
    packet.num_sv_used = num_sv_used;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
}

/**
 * @brief Encode a xap_sbg_gps_pos_msg struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param xap_sbg_gps_pos_msg C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_xap_sbg_gps_pos_msg_t* xap_sbg_gps_pos_msg)
{
    return mavlink_msg_xap_sbg_gps_pos_msg_pack(system_id, component_id, msg, xap_sbg_gps_pos_msg->time_boot_ms, xap_sbg_gps_pos_msg->sbg_id, xap_sbg_gps_pos_msg->gps_id, xap_sbg_gps_pos_msg->gps_pos_status, xap_sbg_gps_pos_msg->gps_tow, xap_sbg_gps_pos_msg->lat, xap_sbg_gps_pos_msg->longit, xap_sbg_gps_pos_msg->alt, xap_sbg_gps_pos_msg->undulation, xap_sbg_gps_pos_msg->pos_acc_lat, xap_sbg_gps_pos_msg->pos_acc_longit, xap_sbg_gps_pos_msg->pos_acc_alt, xap_sbg_gps_pos_msg->num_sv_used, xap_sbg_gps_pos_msg->base_station_id, xap_sbg_gps_pos_msg->diff_age);
}

/**
 * @brief Encode a xap_sbg_gps_pos_msg struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param xap_sbg_gps_pos_msg C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_xap_sbg_gps_pos_msg_t* xap_sbg_gps_pos_msg)
{
    return mavlink_msg_xap_sbg_gps_pos_msg_pack_chan(system_id, component_id, chan, msg, xap_sbg_gps_pos_msg->time_boot_ms, xap_sbg_gps_pos_msg->sbg_id, xap_sbg_gps_pos_msg->gps_id, xap_sbg_gps_pos_msg->gps_pos_status, xap_sbg_gps_pos_msg->gps_tow, xap_sbg_gps_pos_msg->lat, xap_sbg_gps_pos_msg->longit, xap_sbg_gps_pos_msg->alt, xap_sbg_gps_pos_msg->undulation, xap_sbg_gps_pos_msg->pos_acc_lat, xap_sbg_gps_pos_msg->pos_acc_longit, xap_sbg_gps_pos_msg->pos_acc_alt, xap_sbg_gps_pos_msg->num_sv_used, xap_sbg_gps_pos_msg->base_station_id, xap_sbg_gps_pos_msg->diff_age);
}

/**
 * @brief Send a xap_sbg_gps_pos_msg message
 * @param chan MAVLink channel to send the message
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param sbg_id   Sbg device id 
 * @param gps_id   Gps device id 
 * @param gps_pos_status   GPS velocity fix and status bitmask 
 * @param gps_tow   GPS Time of Week, ms 
 * @param lat   Latitude, positive North, deg 
 * @param longit   Longitude, positive East, deg 
 * @param alt   Altitude Above Mean Sea Level, m 
 * @param undulation   Altitude difference between the geoid and the Ellipsoid. (WGS-84 Altitude = MSL Altitude + undulation), m 
 * @param pos_acc_lat   1b Latitude Accuracy, m 
 * @param pos_acc_longit   1b Longitude Accuracy, m 
 * @param pos_acc_alt   1b Altitude Accuracy, m 
 * @param num_sv_used   Number of space vehicles used in GNSS solution 
 * @param base_station_id   ID of the DGPS/RTK base station in use 
 * @param diff_age   Differential data age 
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_xap_sbg_gps_pos_msg_send(mavlink_channel_t chan, uint32_t time_boot_ms, int8_t sbg_id, int8_t gps_id, uint32_t gps_pos_status, uint32_t gps_tow, double lat, double longit, double alt, float undulation, float pos_acc_lat, float pos_acc_longit, float pos_acc_alt, uint8_t num_sv_used, uint16_t base_station_id, uint16_t diff_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN];
    _mav_put_double(buf, 0, lat);
    _mav_put_double(buf, 8, longit);
    _mav_put_double(buf, 16, alt);
    _mav_put_uint32_t(buf, 24, time_boot_ms);
    _mav_put_uint32_t(buf, 28, gps_pos_status);
    _mav_put_uint32_t(buf, 32, gps_tow);
    _mav_put_float(buf, 36, undulation);
    _mav_put_float(buf, 40, pos_acc_lat);
    _mav_put_float(buf, 44, pos_acc_longit);
    _mav_put_float(buf, 48, pos_acc_alt);
    _mav_put_uint16_t(buf, 52, base_station_id);
    _mav_put_uint16_t(buf, 54, diff_age);
    _mav_put_int8_t(buf, 56, sbg_id);
    _mav_put_int8_t(buf, 57, gps_id);
    _mav_put_uint8_t(buf, 58, num_sv_used);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG, buf, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
#else
    mavlink_xap_sbg_gps_pos_msg_t packet;
    packet.lat = lat;
    packet.longit = longit;
    packet.alt = alt;
    packet.time_boot_ms = time_boot_ms;
    packet.gps_pos_status = gps_pos_status;
    packet.gps_tow = gps_tow;
    packet.undulation = undulation;
    packet.pos_acc_lat = pos_acc_lat;
    packet.pos_acc_longit = pos_acc_longit;
    packet.pos_acc_alt = pos_acc_alt;
    packet.base_station_id = base_station_id;
    packet.diff_age = diff_age;
    packet.sbg_id = sbg_id;
    packet.gps_id = gps_id;
    packet.num_sv_used = num_sv_used;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG, (const char *)&packet, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
#endif
}

/**
 * @brief Send a xap_sbg_gps_pos_msg message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_xap_sbg_gps_pos_msg_send_struct(mavlink_channel_t chan, const mavlink_xap_sbg_gps_pos_msg_t* xap_sbg_gps_pos_msg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_xap_sbg_gps_pos_msg_send(chan, xap_sbg_gps_pos_msg->time_boot_ms, xap_sbg_gps_pos_msg->sbg_id, xap_sbg_gps_pos_msg->gps_id, xap_sbg_gps_pos_msg->gps_pos_status, xap_sbg_gps_pos_msg->gps_tow, xap_sbg_gps_pos_msg->lat, xap_sbg_gps_pos_msg->longit, xap_sbg_gps_pos_msg->alt, xap_sbg_gps_pos_msg->undulation, xap_sbg_gps_pos_msg->pos_acc_lat, xap_sbg_gps_pos_msg->pos_acc_longit, xap_sbg_gps_pos_msg->pos_acc_alt, xap_sbg_gps_pos_msg->num_sv_used, xap_sbg_gps_pos_msg->base_station_id, xap_sbg_gps_pos_msg->diff_age);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG, (const char *)xap_sbg_gps_pos_msg, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
#endif
}

#if MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_xap_sbg_gps_pos_msg_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, int8_t sbg_id, int8_t gps_id, uint32_t gps_pos_status, uint32_t gps_tow, double lat, double longit, double alt, float undulation, float pos_acc_lat, float pos_acc_longit, float pos_acc_alt, uint8_t num_sv_used, uint16_t base_station_id, uint16_t diff_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_double(buf, 0, lat);
    _mav_put_double(buf, 8, longit);
    _mav_put_double(buf, 16, alt);
    _mav_put_uint32_t(buf, 24, time_boot_ms);
    _mav_put_uint32_t(buf, 28, gps_pos_status);
    _mav_put_uint32_t(buf, 32, gps_tow);
    _mav_put_float(buf, 36, undulation);
    _mav_put_float(buf, 40, pos_acc_lat);
    _mav_put_float(buf, 44, pos_acc_longit);
    _mav_put_float(buf, 48, pos_acc_alt);
    _mav_put_uint16_t(buf, 52, base_station_id);
    _mav_put_uint16_t(buf, 54, diff_age);
    _mav_put_int8_t(buf, 56, sbg_id);
    _mav_put_int8_t(buf, 57, gps_id);
    _mav_put_uint8_t(buf, 58, num_sv_used);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG, buf, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
#else
    mavlink_xap_sbg_gps_pos_msg_t *packet = (mavlink_xap_sbg_gps_pos_msg_t *)msgbuf;
    packet->lat = lat;
    packet->longit = longit;
    packet->alt = alt;
    packet->time_boot_ms = time_boot_ms;
    packet->gps_pos_status = gps_pos_status;
    packet->gps_tow = gps_tow;
    packet->undulation = undulation;
    packet->pos_acc_lat = pos_acc_lat;
    packet->pos_acc_longit = pos_acc_longit;
    packet->pos_acc_alt = pos_acc_alt;
    packet->base_station_id = base_station_id;
    packet->diff_age = diff_age;
    packet->sbg_id = sbg_id;
    packet->gps_id = gps_id;
    packet->num_sv_used = num_sv_used;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG, (const char *)packet, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_MIN_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_CRC);
#endif
}
#endif

#endif

// MESSAGE XAP_SBG_GPS_POS_MSG UNPACKING


/**
 * @brief Get field time_boot_ms from xap_sbg_gps_pos_msg message
 *
 * @return [ms] Timestamp (milliseconds since system boot)
 */
static inline uint32_t mavlink_msg_xap_sbg_gps_pos_msg_get_time_boot_ms(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  24);
}

/**
 * @brief Get field sbg_id from xap_sbg_gps_pos_msg message
 *
 * @return   Sbg device id 
 */
static inline int8_t mavlink_msg_xap_sbg_gps_pos_msg_get_sbg_id(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int8_t(msg,  56);
}

/**
 * @brief Get field gps_id from xap_sbg_gps_pos_msg message
 *
 * @return   Gps device id 
 */
static inline int8_t mavlink_msg_xap_sbg_gps_pos_msg_get_gps_id(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int8_t(msg,  57);
}

/**
 * @brief Get field gps_pos_status from xap_sbg_gps_pos_msg message
 *
 * @return   GPS velocity fix and status bitmask 
 */
static inline uint32_t mavlink_msg_xap_sbg_gps_pos_msg_get_gps_pos_status(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  28);
}

/**
 * @brief Get field gps_tow from xap_sbg_gps_pos_msg message
 *
 * @return   GPS Time of Week, ms 
 */
static inline uint32_t mavlink_msg_xap_sbg_gps_pos_msg_get_gps_tow(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  32);
}

/**
 * @brief Get field lat from xap_sbg_gps_pos_msg message
 *
 * @return   Latitude, positive North, deg 
 */
static inline double mavlink_msg_xap_sbg_gps_pos_msg_get_lat(const mavlink_message_t* msg)
{
    return _MAV_RETURN_double(msg,  0);
}

/**
 * @brief Get field longit from xap_sbg_gps_pos_msg message
 *
 * @return   Longitude, positive East, deg 
 */
static inline double mavlink_msg_xap_sbg_gps_pos_msg_get_longit(const mavlink_message_t* msg)
{
    return _MAV_RETURN_double(msg,  8);
}

/**
 * @brief Get field alt from xap_sbg_gps_pos_msg message
 *
 * @return   Altitude Above Mean Sea Level, m 
 */
static inline double mavlink_msg_xap_sbg_gps_pos_msg_get_alt(const mavlink_message_t* msg)
{
    return _MAV_RETURN_double(msg,  16);
}

/**
 * @brief Get field undulation from xap_sbg_gps_pos_msg message
 *
 * @return   Altitude difference between the geoid and the Ellipsoid. (WGS-84 Altitude = MSL Altitude + undulation), m 
 */
static inline float mavlink_msg_xap_sbg_gps_pos_msg_get_undulation(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  36);
}

/**
 * @brief Get field pos_acc_lat from xap_sbg_gps_pos_msg message
 *
 * @return   1b Latitude Accuracy, m 
 */
static inline float mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_lat(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  40);
}

/**
 * @brief Get field pos_acc_longit from xap_sbg_gps_pos_msg message
 *
 * @return   1b Longitude Accuracy, m 
 */
static inline float mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_longit(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  44);
}

/**
 * @brief Get field pos_acc_alt from xap_sbg_gps_pos_msg message
 *
 * @return   1b Altitude Accuracy, m 
 */
static inline float mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_alt(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  48);
}

/**
 * @brief Get field num_sv_used from xap_sbg_gps_pos_msg message
 *
 * @return   Number of space vehicles used in GNSS solution 
 */
static inline uint8_t mavlink_msg_xap_sbg_gps_pos_msg_get_num_sv_used(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  58);
}

/**
 * @brief Get field base_station_id from xap_sbg_gps_pos_msg message
 *
 * @return   ID of the DGPS/RTK base station in use 
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_get_base_station_id(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint16_t(msg,  52);
}

/**
 * @brief Get field diff_age from xap_sbg_gps_pos_msg message
 *
 * @return   Differential data age 
 */
static inline uint16_t mavlink_msg_xap_sbg_gps_pos_msg_get_diff_age(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint16_t(msg,  54);
}

/**
 * @brief Decode a xap_sbg_gps_pos_msg message into a struct
 *
 * @param msg The message to decode
 * @param xap_sbg_gps_pos_msg C-struct to decode the message contents into
 */
static inline void mavlink_msg_xap_sbg_gps_pos_msg_decode(const mavlink_message_t* msg, mavlink_xap_sbg_gps_pos_msg_t* xap_sbg_gps_pos_msg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    xap_sbg_gps_pos_msg->lat = mavlink_msg_xap_sbg_gps_pos_msg_get_lat(msg);
    xap_sbg_gps_pos_msg->longit = mavlink_msg_xap_sbg_gps_pos_msg_get_longit(msg);
    xap_sbg_gps_pos_msg->alt = mavlink_msg_xap_sbg_gps_pos_msg_get_alt(msg);
    xap_sbg_gps_pos_msg->time_boot_ms = mavlink_msg_xap_sbg_gps_pos_msg_get_time_boot_ms(msg);
    xap_sbg_gps_pos_msg->gps_pos_status = mavlink_msg_xap_sbg_gps_pos_msg_get_gps_pos_status(msg);
    xap_sbg_gps_pos_msg->gps_tow = mavlink_msg_xap_sbg_gps_pos_msg_get_gps_tow(msg);
    xap_sbg_gps_pos_msg->undulation = mavlink_msg_xap_sbg_gps_pos_msg_get_undulation(msg);
    xap_sbg_gps_pos_msg->pos_acc_lat = mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_lat(msg);
    xap_sbg_gps_pos_msg->pos_acc_longit = mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_longit(msg);
    xap_sbg_gps_pos_msg->pos_acc_alt = mavlink_msg_xap_sbg_gps_pos_msg_get_pos_acc_alt(msg);
    xap_sbg_gps_pos_msg->base_station_id = mavlink_msg_xap_sbg_gps_pos_msg_get_base_station_id(msg);
    xap_sbg_gps_pos_msg->diff_age = mavlink_msg_xap_sbg_gps_pos_msg_get_diff_age(msg);
    xap_sbg_gps_pos_msg->sbg_id = mavlink_msg_xap_sbg_gps_pos_msg_get_sbg_id(msg);
    xap_sbg_gps_pos_msg->gps_id = mavlink_msg_xap_sbg_gps_pos_msg_get_gps_id(msg);
    xap_sbg_gps_pos_msg->num_sv_used = mavlink_msg_xap_sbg_gps_pos_msg_get_num_sv_used(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN? msg->len : MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN;
        memset(xap_sbg_gps_pos_msg, 0, MAVLINK_MSG_ID_XAP_SBG_GPS_POS_MSG_LEN);
    memcpy(xap_sbg_gps_pos_msg, _MAV_PAYLOAD(msg), len);
#endif
}
